package arcade.units;

import geom.Vector;

import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;

import javax.swing.ImageIcon;

public class Image extends Unit {
	private java.awt.Image myImage = null;

	/**
	 * File extension constants
	 */
	public final String IMAGEFILE = "images/";

	public final String EXT = ".gif";

	public Image(String role, Point2D center, Dimension2D size, Vector speed) {
		super(role, center, size, new Rectangle2D.Double(0, 0, 1, 1), speed);
		setImage();
	}

	public void setImage() {
		myImage = new ImageIcon(IMAGEFILE + getRole() + EXT).getImage();
	}

	protected void render(java.awt.Graphics2D pen) {
		pen.drawImage(myImage, 0, 0, 1, 1, null);
	}
}
